package offer;

import java.util.Deque;
import java.util.LinkedList;

public class offer59_II {
    public static void main(String[] args) {
        Deque<Integer> queue = new LinkedList<>();
        queue.push(1);
        queue.push(2);
        queue.pop();  //2
        queue.addFirst(3);//3->1
        queue.addFirst(4);//4->3->1
        queue.pollFirst(); //3->1
        queue.addLast(5); //3->1->5
        queue.addLast(6); //3->1->5->6
        queue.pollFirst(); //1->5->6
        queue.poll();//5->6
        queue.pollLast(); //5
        System.out.println(queue);
    }
}
